// Sprite Scene Node
// (c) jimon game studio

#ifndef JEH_CSPRITESCENENODE
#define JEH_CSPRITESCENENODE

#include "ISpriteSceneNode.h"
#include "ISceneManager.h"

namespace je
{
	namespace scene
	{
		// Sprite Scene Node
		class CSpriteSceneNode:public je::scene::ISpriteSceneNode
		{
		private:
			scene::ISceneManager * CurrentSceneManager;

			jeMatrix4f SpriteMatrix;
			jeMatrix4f SpriteAbsoluteModelMatrix;
			jeVector3df SpriteSize;
			jeVector3df SpriteCorrectionSize;
			s32 LastFrame;
			s32 CurrentFrame;
		public:
			//! Constructor
			CSpriteSceneNode(video::IRender * Render,scene::ISceneManager * SceneManager);

			//! Destructor
			~CSpriteSceneNode();

			//! Set Frame
			void SetFrame(s32 Frame);

			//! Get Frame
			s32 GetFrame();

			//! Get Frame Count
			s32 GetFrameCount();

			//! Set Material Resource
			void SetMaterialResource(media::jeMaterialResource * MaterialResource,u1 UseUniqueMaterial = true,u1 UseUniqueTextures = true,u1 UseUniqueShader = true);

			//! On Update
			void OnUpdate();

			//! On Render
			void OnRender();

			//! On Visibility Culling
			void OnVisibilityCulling();

			//! Rebuild Transformations
			void RebuildTransformations();

			//! Build Absolute Model Matrix
			void BuildAbsoluteModelMatrix(const jeMatrix4f & ParentMatrix,const jeVector3df & ParentScale,u1 Changed);

			//! Serialize
			void Serialize(core::ISerializeStream * SerializeStream);

			//! Get Node Type Name
			jeStringc GetNodeTypeName()
			{
				return jeStringc("SpriteSceneNode");
			}
		};
	}
}

#endif
